var countdown=function(){
    var endtime=new Date('2018/10/09 17:43:00');
    var timer=setInterval(autoplay,1000)
    function autoplay(){
        var data=new Date();
        var ms=endtime.getTime()-data.getTime();
        var s=parseInt(ms/1000);
        var day=parseInt(s/3600/24);
        var hour=parseInt(s/3600%24);
        var minute=parseInt(s/60%60);
        var second=parseInt(s%60); 
        if(day<=0&&hour<=0&&minute<=0&&second<=0){
            day=hour=minute=second=0;
            clearInterval(timer);
        }
        day=day<10?'0'+day:day;
        hour=hour<10?'0'+hour:hour;
        minute=minute<10?'0'+minute:minute;
        second=second<10?'0'+second:second;
        document.getElementById('day').innerHTML=day;
        document.getElementById('hour').innerHTML=hour;
        document.getElementById('minute').innerHTML=minute;
        document.getElementById('second').innerHTML=second;
        
    }   
            
}